<template><div><h2 id="发行说明" tabindex="-1"><a class="header-anchor" href="#发行说明"><span>发行说明</span></a></h2>
<ul>
<li>
<p><a href="https://learnku.com/docs/laravel/10.x/releases/#versioning-scheme" target="_blank" rel="noopener noreferrer">版本控制方案</a></p>
</li>
<li>
<p><a href="https://learnku.com/docs/laravel/10.x/releases/#support-policy" target="_blank" rel="noopener noreferrer">支持政策</a></p>
</li>
<li>
<p><a href="https://learnku.com/docs/laravel/10.x/releases/#laravel-10" target="_blank" rel="noopener noreferrer">Laravel 10</a></p>
</li>
</ul>
<h2 id="版本控制方案" tabindex="-1"><a class="header-anchor" href="#版本控制方案"><span>版本控制方案</span></a></h2>
<p>Laravel 和它的其他第一方软件包遵循 <a href="https://semver.org/" target="_blank" rel="noopener noreferrer">语义化版本控制</a>。主要框架版本释出是每年 (~Q1)，而较小和补丁版本则可能每周释出一次。较小和补丁版本决不能包含破坏性更改。</p>
<p>当从你的应用程序或软件包引用 Laravel 框架或其组件时，应始终使用类似 <code v-pre>^10.0</code> 的版本约束，因为 Laravel 的主要版本包含破坏性更改。但是，我们始终努力确保你可以在一天或更短时间内更新到新的主要版本。</p>
<h4 id="命名参数" tabindex="-1"><a class="header-anchor" href="#命名参数"><span>命名参数</span></a></h4>
<p><a href="https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments" target="_blank" rel="noopener noreferrer">命名参数</a> 未被 Laravel 的向后兼容性指导方针所覆盖。我们可能会在必要时重命名函数参数，以改进 Laravel 代码库。因此，当调用 Laravel 方法时使用命名参数应该谨慎进行，并且要知道参数名称可能会在未来更改。</p>
<h2 id="支持政策" tabindex="-1"><a class="header-anchor" href="#支持政策"><span>支持政策</span></a></h2>
<p>对于所有 Laravel 版本，修复错误将提供 18 个月支持，而安全修复将提供 2 年支持。对于所有其他库，包括 Lumen，在更新最新的主要发布版本之前只提供 bug 修复。此外，请查看 <a href="https://learnku.com/docs/laravel/10.x/databasemd/14882#e05dce" target="_blank" rel="noopener noreferrer">Laravel 支持的数据库版本</a>。</p>
<table>
<thead>
<tr>
<th>版本</th>
<th>PHP (*)</th>
<th>发布日期</th>
<th>Bug 修复截止日期</th>
<th>安全修复截止日期</th>
</tr>
</thead>
<tbody>
<tr>
<td>8</td>
<td>7.3 - 8.1</td>
<td>2020 年 9 月 8 日</td>
<td>2022 年 7 月 26 日</td>
<td>2023 年 1 月 24 日</td>
</tr>
<tr>
<td>9</td>
<td>8.0 - 8.2</td>
<td>2022 年 2 月 8 日</td>
<td>2023 年 8 月 8 日</td>
<td>2024 年 2 月 6 日</td>
</tr>
<tr>
<td>10</td>
<td>8.1 - 8.2</td>
<td>2023 年 2 月 14 日</td>
<td>2024 年 8 月 6 日</td>
<td>2025 年 2 月 4 日</td>
</tr>
<tr>
<td>11</td>
<td>8.2</td>
<td>2024 年 Q1</td>
<td>2025 年 8 月 5 日</td>
<td>2026 年 2 月 3 日</td>
</tr>
</tbody>
</table>
<p>(*) 支持的 PHP 版本</p>
<h2 id="laravel-10" tabindex="-1"><a class="header-anchor" href="#laravel-10"><span>Laravel 10</span></a></h2>
<p>正如你可能已经知道的那样，Laravel 在发布 Laravel 8 后转向每年发布一次。之前，每 6 个月发布一个主要版本。这种转变旨在减轻社区的维护负担，并挑战我们的开发团队在不引入破坏性变化的情况下发布令人惊叹、功能强大的新功能。因此，我们为 Laravel 9 提供了许多强大的功能，而不会破坏向后兼容性。</p>
<p>因此，这种致力于在当前发布期间发布出色新功能的承诺可能会导致未来的「主要」版本主要用于诸如升级上游依赖项之类的「维护」任务，这些可以在这些发布说明中看到。</p>
<p>Laravel 10 继续在 Laravel 9.x 中所做的改进，通过向所有应用程序骨架方法和所有存根文件引入参数和返回类型，以及向外部进程启动和交互引入了一种新的开发人员友好的抽象层。此外，引入了 Laravel Pennant，为管理你的应用程序的「特性标志」提供了一种奇妙的方法。</p>
<h3 id="php-8-1" tabindex="-1"><a class="header-anchor" href="#php-8-1"><span>PHP 8.1</span></a></h3>
<p>Laravel 10.x 要求至少使用 PHP 版本 8.1。</p>
<h3 id="types" tabindex="-1"><a class="header-anchor" href="#types"><span>Types</span></a></h3>
<p><em>应用程序骨架和存根的类型提示由 <a href="https://github.com/nunomaduro" target="_blank" rel="noopener noreferrer">Nuno Maduro</a> 提供。</em></p>
<p>在最初发布时，Laravel 利用了 PHP 当时提供的所有类型提示特性。然而，在随后的几年中，PHP 添加了许多新的功能，包括额外的基本类型提示、返回类型和联合类型。</p>
<p>Laravel 10.x 彻底更新了应用程序骨架和框架使用的所有存根，以向所有方法签名引入参数和返回类型。此外，已删除冗余的 「doc block」 类型提示信息。</p>
<p>这个更改完全向后兼容现有应用程序。因此，没有这些类型提示的现有应用程序将继续正常运行。</p>
<h3 id="laravel-pennant" tabindex="-1"><a class="header-anchor" href="#laravel-pennant"><span>Laravel Pennant</span></a></h3>
<p><em>Laravel Pennant 由 <a href="https://github.com/timacdonald" target="_blank" rel="noopener noreferrer">Tim MacDonald</a> 贡献。</em></p>
<p>发布了一个新的第一方软件包，Laravel Pennant。Laravel Pennant 提供了一种轻量级、简洁的方法来管理应用程序的特性标志。Pennant 出厂时包括一个内存中的 <code v-pre>array</code> 驱动程序和一个 <code v-pre>database</code> 驱动程序，用于持久化特性存储。</p>
<p>可以通过 <code v-pre>Feature::define</code> 方法轻松地定义特性：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token keyword">use</span> <span class="token package">Laravel<span class="token punctuation">\</span>Pennant<span class="token punctuation">\</span>Feature</span><span class="token punctuation">;</span></span>
<span class="line"></span>
<span class="line"><span class="token keyword">use</span> <span class="token package">Illuminate<span class="token punctuation">\</span>Support<span class="token punctuation">\</span>Lottery</span><span class="token punctuation">;</span></span>
<span class="line"></span>
<span class="line"><span class="token class-name static-context">Feature</span><span class="token operator">::</span><span class="token function">define</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'new-onboarding-flow'</span><span class="token punctuation">,</span> <span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span></span>
<span class="line"></span>
<span class="line"><span class="token keyword">return</span> <span class="token class-name static-context">Lottery</span><span class="token operator">::</span><span class="token function">odds</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span>
<span class="line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>定义特性后，你可以轻松地确定当前用户是否有访问给定特性的权限：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token class-name static-context">Feature</span><span class="token operator">::</span><span class="token function">active</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'new-onboarding-flow'</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">{</span></span>
<span class="line"></span>
<span class="line"><span class="token comment">// ...</span></span>
<span class="line"></span>
<span class="line"><span class="token punctuation">}</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>当然，为了方便起见，Blade 指令也可用：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">@<span class="token function">feature</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'new-onboarding-flow'</span><span class="token punctuation">)</span></span>
<span class="line"></span>
<span class="line"><span class="token operator">&lt;</span>div<span class="token operator">></span></span>
<span class="line"></span>
<span class="line"><span class="token operator">&lt;</span><span class="token operator">!</span><span class="token operator">--</span> <span class="token operator">...</span> <span class="token operator">--</span><span class="token operator">></span></span>
<span class="line"></span>
<span class="line"><span class="token operator">&lt;</span><span class="token operator">/</span>div<span class="token operator">></span></span>
<span class="line"></span>
<span class="line">@endfeature</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Pennant 提供了各种更高级的特性和 API。有关更多信息，请参阅 <a href="https://learnku.com/docs/laravel/10.x/pennantmd/14911" target="_blank" rel="noopener noreferrer">详细的 Pennant 文档</a>。</p>
<h3 id="进程交互" tabindex="-1"><a class="header-anchor" href="#进程交互"><span>进程交互</span></a></h3>
<p><em>进程抽象层由 <a href="https://github.com/nunomaduro" target="_blank" rel="noopener noreferrer">Nuno Maduro</a> 和 <a href="https://github.com/taylorotwell" target="_blank" rel="noopener noreferrer">Taylor Otwell</a> 贡献。</em></p>
<p>Laravel 10.x 引入了一个美丽的抽象层，用于通过新的 <code v-pre>Process</code> 门面启动和与外部进程交互：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token keyword">use</span> <span class="token package">Illuminate<span class="token punctuation">\</span>Support<span class="token punctuation">\</span>Facades<span class="token punctuation">\</span>Process</span><span class="token punctuation">;</span></span>
<span class="line"></span>
<span class="line"><span class="token variable">$result</span> <span class="token operator">=</span> <span class="token class-name static-context">Process</span><span class="token operator">::</span><span class="token function">run</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'ls -la'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span>
<span class="line"><span class="token keyword">return</span>  <span class="token variable">$result</span><span class="token operator">-></span><span class="token function">output</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>甚至可以在池中启动进程，允许方便地执行和管理并发进程：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token keyword">use</span> <span class="token package">Illuminate<span class="token punctuation">\</span>Process<span class="token punctuation">\</span>Pool</span><span class="token punctuation">;</span></span>
<span class="line"></span>
<span class="line"><span class="token keyword">use</span> <span class="token package">Illuminate<span class="token punctuation">\</span>Support<span class="token punctuation">\</span>Facades<span class="token punctuation">\</span>Process</span><span class="token punctuation">;</span></span>
<span class="line"></span>
<span class="line"><span class="token punctuation">[</span><span class="token variable">$first</span><span class="token punctuation">,</span> <span class="token variable">$second</span><span class="token punctuation">,</span> <span class="token variable">$third</span><span class="token punctuation">]</span> <span class="token operator">=</span>  <span class="token class-name static-context">Process</span><span class="token operator">::</span><span class="token function">concurrently</span><span class="token punctuation">(</span><span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token class-name type-declaration">Pool</span>  <span class="token variable">$pool</span><span class="token punctuation">)</span> <span class="token punctuation">{</span></span>
<span class="line"></span>
<span class="line"><span class="token variable">$pool</span><span class="token operator">-></span><span class="token function">command</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'cat first.txt'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span>
<span class="line"><span class="token variable">$pool</span><span class="token operator">-></span><span class="token function">command</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'cat second.txt'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span>
<span class="line"><span class="token variable">$pool</span><span class="token operator">-></span><span class="token function">command</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'cat third.txt'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span>
<span class="line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span>
<span class="line"><span class="token keyword">return</span>  <span class="token variable">$first</span><span class="token operator">-></span><span class="token function">output</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>这一变化完全向后兼容现有的应用程序。因此，没有这些类型提示的现有应用程序将继续正常运行。</p>
<p>此外，进程可能会被虚构，以方便测试：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token class-name static-context">Process</span><span class="token operator">::</span><span class="token function">fake</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span>
<span class="line"><span class="token comment">// ...</span></span>
<span class="line"></span>
<span class="line"><span class="token class-name static-context">Process</span><span class="token operator">::</span><span class="token function">assertRan</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'ls -la'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>有关与进程交互的更多信息，请参阅 <a href="https://learnku.com/docs/laravel/10.x/processesmd/14872" target="_blank" rel="noopener noreferrer">详细的进程管理文档</a>。</p>
<h3 id="测试分析" tabindex="-1"><a class="header-anchor" href="#测试分析"><span>测试分析</span></a></h3>
<p><em>测试分析由 <a href="https://github.com/nunomaduro" target="_blank" rel="noopener noreferrer">Nuno Maduro</a> 贡献。</em></p>
<p>Artisan 的 <code v-pre>test</code> 命令现在具有一个新的 <code v-pre>--profile</code> 选项，使你可以轻松识别应用程序中最慢的测试：</p>
<div class="language-bash line-numbers-mode" data-highlighter="prismjs" data-ext="sh" data-title="sh"><pre v-pre class="language-bash"><code><span class="line">php artisan  <span class="token builtin class-name">test</span>  <span class="token parameter variable">--profile</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><p>为了方便起见，最慢的测试将直接显示在 CLI 输出中：</p>
<p><img src="https://user-images.githubusercontent.com/5457236/217328439-d8d983ec-d0fc-4cde-93d9-ae5bccf5df14.png" alt="217328439-d8d983ec-d0fc-4cde-93d9-ae5bccf5df14.png"></p>
<h3 id="pest-脚手架" tabindex="-1"><a class="header-anchor" href="#pest-脚手架"><span>Pest 脚手架</span></a></h3>
<p>现在，新的 Laravel 项目可以默认使用 Pest 测试脚手架。要启用此功能，请在通过 Laravel 安装程序创建新应用程序时提供 <code v-pre>--pest</code> 标志：</p>
<div class="language-bash line-numbers-mode" data-highlighter="prismjs" data-ext="sh" data-title="sh"><pre v-pre class="language-bash"><code><span class="line">laravel new  example-application  <span class="token parameter variable">--pest</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="生成器-cli-提示" tabindex="-1"><a class="header-anchor" href="#生成器-cli-提示"><span>生成器 CLI 提示</span></a></h3>
<p><em>生成器 CLI 提示由 <a href="https://github.com/jessarcher" target="_blank" rel="noopener noreferrer">Jess Archer</a> 贡献。</em></p>
<p>为了改进框架的开发体验，Laravel 内置的所有 make 命令现在不需要任何输入。如果调用命令时没有输入，你将被提示提供所需的参数：</p>
<div class="language-bash line-numbers-mode" data-highlighter="prismjs" data-ext="sh" data-title="sh"><pre v-pre class="language-bash"><code><span class="line">php artisan  make:controller</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="horizon-telescope-界面更新" tabindex="-1"><a class="header-anchor" href="#horizon-telescope-界面更新"><span>Horizon / Telescope 界面更新</span></a></h3>
<p><a href="https://learnku.com/docs/laravel/10.x/horizonmd/14906" target="_blank" rel="noopener noreferrer">Horizon</a> 和 <a href="https://learnku.com/docs/laravel/10.x/telescopemd/14917" target="_blank" rel="noopener noreferrer">Telescope</a> 已经通过改进版式、间距和设计更新为新的现代外观：</p>
<p><img src="https://laravel.com/img/docs/horizon-example.png" alt="horizon-example.png"></p>
<blockquote>
<p>本译文仅用于学习和交流目的，转载请务必注明文章译者、出处、和本文链接<br>
我们的翻译工作遵照 <a href="https://learnku.com/docs/guide/cc4.0/6589" target="_blank" rel="noopener noreferrer">CC 协议</a>，如果我们的工作有侵犯到您的权益，请及时联系我们。</p>
</blockquote>
<hr>
<blockquote>
<p>原文地址：<a href="https://learnku.com/docs/laravel/10.x/releases/14832" target="_blank" rel="noopener noreferrer">https://learnku.com/docs/laravel/10.x/re...</a></p>
<p>译文地址：<a href="https://learnku.com/docs/laravel/10.x/releases/14832" target="_blank" rel="noopener noreferrer">https://learnku.com/docs/laravel/10.x/re...</a></p>
</blockquote>
</div></template>


